<?php
/**
 * Object Relational Persistence Mapping Class for table: rad_result_meta
 *
 * @package	com.athena
 * @author	LHV
 */
class RadResultMeta extends ORDataObject {

	/**#@+
	 * Fields of table: rad_result_meta mapped to class members
	 */
	var $rad_result_meta_id		= '';
	var $rad_ticket_item_id		= '';
	var $doctor_id         		= '';
	var $technican1_id     		= '';
	var $technican2_id     		= '';
	var $machine_name      		= '';
	var $description       		= '';
	var $conclusion        		= '';
	var $created           		= '';
	/**#@-*/


	/**
	 * DB Table
	 */
	var $_table = 'rad_result_meta';

	/**
	 * Primary Key
	 */
	var $_key = 'rad_result_meta_id';

	/**
	 * Internal Name
	 */
	var $_internalName = 'RadResultMeta';

	/**
	 * Handle instantiation
	 */
	function RadResultMeta() {
		parent::ORDataObject();
	}

	public function getObjectByTicketItem($radTicketItemId) {
        $sql    =   "SELECT $this->_key id FROM $this->_table WHERE rad_ticket_item_id='$radTicketItemId'";
        $res    =   $this->_execute($sql);
        $obj    =   Celini::newORDO('RadResultMeta', $res->fields['id']);
        return $obj;
	}

	public function setData($radTicketItemId, $doctorId, $techId1, $techId2,
    	   $machine, $desciption, $conclusion, $created) {
        $data   =   array(
            'rad_ticket_item_id'    =>  $radTicketItemId,
            'doctor_id'             =>  $doctorId,
            'technican1_id'         =>  $techId1,
            'technican2_id'         =>  $techId2,
            'machine_name'          =>  $machine,
            'description'           =>  $desciption,
            'conclusion'            =>  $conclusion,
            'created'               =>  $created
        );
        $this->populateArray($data);
    }

    public function getTechnicianId1() {
    	return $this->technican1_id;
    }

    public function getTechnicianId2() {
        return $this->technican2_id;
    }

    public function getDoctorId() {
    	return $this->doctor_id;
    }

    public function getDescription() {
    	return $this->description;
    }

    public function getConclusion() {
        return $this->conclusion;
    }

    public function getMachineName() {
        return $this->machine_name;
    }

    public function getCreated() {
    	return L10nHelper::renderDateTime($this->created, null, 'datetime');
    }
}
?>
